/**
 * @file    cae_intf.h
 * @brief   CAE Interface Header File
 * 
 * @version 1.0
 * @date    2018/05/29
 * 
 * @see        
 * 
 * History:
 * index    version        date            author        notes
 * 0        1.0            2018/05/29      tiange      Create this file
						   2019/03/04	   weiliu	   Modify this file			
 */
 
#ifndef __CAE_INTF_H__
#define __CAE_INTF_H__



typedef void * CAE_HANDLE; 

struct AiotOS
{
	void *(*allocateMemory)(size_t size); 
	void(*freeMemory)(void * pointer);   
	void *(*reallocateMemory)(void * pointer, size_t size); 
};



#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if 0
_declspec(dllimport) 	typedef int(*cae_ivw_cb)(short angle, short beam, char* keword, float power, short score, void *userdata, void *reserved);

_declspec(dllimport) 	typedef int(*cae_audio_cb)(const char *audiodata, unsigned int audiolen, void *userdata, void *reserved);

_declspec(dllimport) 	typedef int(*ivw_audio_cb)(const char *audiodata, unsigned int audiolen, void *userdata, void *reserved);

_declspec(dllimport) 	typedef int(*engine_sfgd_cb)(const void *hint, unsigned int hint_len, int sfgd_model, void *userdata, void *reserve);
_declspec(dllimport) int CAENew(CAE_HANDLE *handle, const char *resPath, void *reserved);
_declspec(dllimport) typedef int (* Proc_CAENew)(CAE_HANDLE *handle, const char* respath, void *reserved);
					 
_declspec(dllimport) int CAEAudioWrite(CAE_HANDLE handle, const char *audiodata, unsigned int audiolen);
_declspec(dllimport) typedef int (* Proc_CAEAudioWrite)(CAE_HANDLE handle, const char *audiodata, unsigned int audiolen);
_declspec(dllimport) int CAEAudioWriteMic(CAE_HANDLE handle, const char *audiodata, unsigned int audiolen);
_declspec(dllimport) typedef int (* Proc_CAEAudioWriteMic)(CAE_HANDLE handle, const void* audiodata, unsigned int audiolen);
_declspec(dllimport) int CAEAudioWriteRef(CAE_HANDLE handle, const char *audiodata, unsigned int audiolen);
_declspec(dllimport) typedef int (* Proc_CAEAudioWriteRef)(CAE_HANDLE handle, const void* audiodata, unsigned int audiolen);
					 
_declspec(dllimport) int CAEReset(CAE_HANDLE handle);
_declspec(dllimport) typedef int (* Proc_CAEReset)(CAE_HANDLE handle);
					 
_declspec(dllimport) int CAESetListener(CAE_HANDLE handle, const int cbtype, void* listener, void *userdata);
_declspec(dllimport) typedef int (* Proc_CAESetListener)(CAE_HANDLE handle, const int  cbtype, void* listener, void *userdata);
					 
_declspec(dllimport) int CAELoadResource(CAE_HANDLE handle, const char* respath);
_declspec(dllimport) typedef int (* Proc_CAELoadResource)(CAE_HANDLE handle, const char* respath);

_declspec(dllimport) int CAESetParam(CAE_HANDLE handle, const int param, void* value, unsigned int valuelen);
_declspec(dllimport) typedef int (* Proc_CAESetParam)(CAE_HANDLE handle, const char* param, void* value, unsigned int valueLen);

_declspec(dllimport) int CAEGetParam(CAE_HANDLE handle, const int param, char* value, unsigned int *valuelen);
_declspec(dllimport) typedef int (* Proc_CAEGetParam)(CAE_HANDLE handle, const char* param, char* value, unsigned int *valuelen);

_declspec(dllimport) int CAEInit(struct AiotOS * param);
_declspec(dllimport) typedef int (* Proc_CAEInit)(struct AiotOS * param);

_declspec(dllimport) int CAEUnInit();
_declspec(dllimport) typedef int (* Proc_CAEUnInit)();

_declspec(dllimport) int CAEDestroy(CAE_HANDLE handle);
_declspec(dllimport) typedef int (* Proc_CAEDestroy)(CAE_HANDLE handle);

_declspec(dllimport) char* CAEGetVersion();
_declspec(dllimport) typedef char* (* Proc_CAEGetVersion)();
#else
	typedef int(*cae_ivw_cb)(short angle, short beam, char* keword, float power, short score, void *userdata, void *reserved);

	typedef int(*cae_audio_cb)(const char *audiodata, unsigned int audiolen, void *userdata, void *reserved);

	typedef int(*ivw_audio_cb)(const char *audiodata, unsigned int audiolen, void *userdata, void *reserved);

	typedef int(*engine_sfgd_cb)(const void *hint, unsigned int hint_len, int sfgd_model, void *userdata, void *reserve);
int CAENew(CAE_HANDLE *handle, const char * mMem, void *reserved);
typedef int (* Proc_CAENew)(CAE_HANDLE *handle, const char* mMem, void *reserved);

int CAEAudioWrite(CAE_HANDLE handle, const char* audio_data, unsigned int audio_len);
typedef int (*Proc_CAEAudioWrite)(CAE_HANDLE handle, const char* audio_data, unsigned int audio_len);

int CAEReset(CAE_HANDLE handle);
typedef int (* Proc_CAEReset)(CAE_HANDLE handle);

int CAESetListener(CAE_HANDLE handle, const int cbtype, void* listener, void *userdata);
typedef int (* Proc_CAESetListener)(CAE_HANDLE handle, const int  cbtype, void* listener, void *userdata);

int CAESetParam(CAE_HANDLE handle, const int param, void* value, unsigned int valuelen);
typedef int (* Proc_CAESetParam)(CAE_HANDLE handle, const char* param, void* value, unsigned int valueLen);

int CAEGetParam(CAE_HANDLE handle, const int param, char* value, unsigned int *valuelen);
typedef int (* Proc_CAEGetParam)(CAE_HANDLE handle, const char* param, char* value, unsigned int *valuelen);

int CAEInit(struct AiotOS * param);
typedef int (* Proc_CAEInit)(struct AiotOS * param);

int CAEUnInit();
typedef int (* Proc_CAEUnInit)();

int CAEDestroy(CAE_HANDLE handle);
typedef int (* Proc_CAEDestroy)(CAE_HANDLE handle);

char* CAEGetVersion();
typedef char* (* Proc_CAEGetVersion)();
#endif
#ifdef __cplusplus
}

#endif /* __cplusplus */

#endif /* __CAE_INTF_H__ */